package pl.druminski.robinhood.updater.view;

import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import pl.druminski.robinhood.updater.model.Data;

/**
 * @author Łukasz Drumiński
 * 
 */
public class Gui extends JFrame
{
    public JProgressBar progressBig = new JProgressBar(0, 100);
    public JProgressBar progressSmall = new JProgressBar(0, 100);
    public JTextArea screen = new JTextArea();

    private Data data = null;

    public Gui(Data data)
    {
        this.data = data;

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLayout(new BorderLayout());
        setTitle("Robin Hood Updater");

        progressBig.setPreferredSize(new Dimension(480, 20));
        progressSmall.setPreferredSize(new Dimension(480, 20));
        progressBig.setStringPainted(true);
        progressSmall.setStringPainted(true);
        screen.setEditable(false);

        JPanel pnl = new JPanel();
        pnl.setPreferredSize(new Dimension(500, 60));
        pnl.add(progressBig, BorderLayout.NORTH);
        pnl.add(progressSmall, BorderLayout.SOUTH);

        add(pnl, BorderLayout.NORTH);
        
        JScrollPane js = new JScrollPane(screen);
        js.setPreferredSize(new Dimension(500, 100));
        add(js);

        pack();

        //ustaw rame na srodku pulpitu
        setLocationRelativeTo(null);
        setVisible(true);
    }
}
